﻿using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace zoo.Model.binding
{
    public class TreeNode
    {
        public string Name { get; set; }
        public ObservableCollection<TreeNode> Children { get; set; }

        public bool IsExpanded
        {
            get; set;
        }

        public NodeType NodeType { get; set; }
    }

    public class TreeNodeConfig : BindableBase, INotifyPropertyChanged
    {
        public long Id { get; set; }

        private string _name;
        public string Name
        {
            get { return _name; }
            set
            {
                if (_name != value)
                {
                    _name = value;
                    RaisePropertyChanged(nameof(Name));
                }
            }
        }
        public TreeNodeConfig Father { get; set; }
        public ObservableCollection<TreeNodeConfig> Children { get; set; }

        private bool _isExpanded;

        public bool IsExpanded
        {
            get { return _isExpanded; }
            set
            {
                if (_isExpanded != value)
                {
                    _isExpanded = value;
                    RaisePropertyChanged(nameof(IsExpanded));
                }
            }
        }


        private bool isSelected = false;
        public bool IsSelected
        {
            get { return this.isSelected; }
            set
            {
                if (isSelected != value)
                {
                    isSelected = value;
                    RaisePropertyChanged(nameof(IsSelected));
                }
            }
        }

        private bool _isEditable;
        public bool IsEditable
        {
            get { return _isEditable; }
            set
            {
                if (_isEditable != value)
                {
                    _isEditable = value;
                    RaisePropertyChanged(nameof(IsEditable));
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void RaisePropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }

        public NodeType NodeType { get; set; }
    }

    public enum NodeType1
    {
        //Folder,
        //Document,
        System,
        Rack,
        Chassis,
        Module,


    }

    public enum NodeType
    {
        //Folder,
        //Document,
        pc,
        rack,
        slot,
        chassis,
        // 添加更多节点类型
    }

}
